<%@ page import="registerallocator.Disciplina" %>



<div class="fieldcontain ${hasErrors(bean: disciplinaInstance, field: 'nome', 'error')} required">
	<label for="nome">
		<g:message code="disciplina.nome.label" default="Nome" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="nome" required="" value="${disciplinaInstance?.nome}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: disciplinaInstance, field: 'credito', 'error')} required">
	<label for="credito">
		<g:message code="disciplina.credito.label" default="Credito" />
		<span class="required-indicator">*</span>
	</label>
	<g:field type="number" name="credito" min="0" required="" value="${fieldValue(bean: disciplinaInstance, field: 'credito')}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: disciplinaInstance, field: 'carga', 'error')} required">
	<label for="carga">
		<g:message code="disciplina.carga.label" default="Carga" />
		<span class="required-indicator">*</span>
	</label>
	<g:field type="number" name="carga" min="0" required="" value="${fieldValue(bean: disciplinaInstance, field: 'carga')}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: disciplinaInstance, field: 'historico', 'error')} required">
	<label for="historico">
		<g:message code="disciplina.historico.label" default="Historico" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="historico" name="historico.id" from="${registerallocator.Historico.list()}" optionKey="id" required="" value="${disciplinaInstance?.historico?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: disciplinaInstance, field: 'periodo', 'error')} ">
	<label for="periodo">
		<g:message code="disciplina.periodo.label" default="Periodo" />
		
	</label>
	
</div>

<div class="fieldcontain ${hasErrors(bean: disciplinaInstance, field: 'preRequisito', 'error')} required">
	<label for="preRequisito">
		<g:message code="disciplina.preRequisito.label" default="Pre Requisito" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="preRequisito" name="preRequisito.id" from="${registerallocator.PreRequisito.list()}" optionKey="id" required="" value="${disciplinaInstance?.preRequisito?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: disciplinaInstance, field: 'turmas', 'error')} ">
	<label for="turmas">
		<g:message code="disciplina.turmas.label" default="Turmas" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${disciplinaInstance?.turmas?}" var="t">
    <li><g:link controller="turma" action="show" id="${t.id}">${t?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="turma" action="create" params="['disciplina.id': disciplinaInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'turma.label', default: 'Turma')])}</g:link>
</li>
</ul>

</div>

